/**
 *	all functions related to the 'LoginPage' view
**/

if (typeof Controllers === "undefined") {
	var Controllers = { }
}

Controllers.LoginPage = {
	
	//'start' button - do some error checking then store the results
	begin: function() {
		var el = {
			user: document.getElementById('LPuser'),
			game: document.getElementById('LPgamelist'),
		}
		
		//error checking
		if (el.user.value == '') {
			alert('please enter a username')
			return
		}
		
		//store this info somewhere useful
		Main.clientInfo = {
			online: true,
			user: el.user.value,
			gameType: el.game.options[el.game.selectedIndex].text
		}
		
		Main.goTo('MatchPage')
	},
	
	//go directly to the game page
/*
	offlineGame: function() {
		var el = {
			user: document.getElementById('LPuser'),
			game: document.getElementById('LPgamelist'),
		}

		//store this info somewhere useful
		Main.clientInfo = {
			online: false,
			user: el.user.value,
			gameType: el.game.options[el.game.selectedIndex].text
		}
		
		var game = {
			players: [ 'player1', 'player2' ],
			winner: 0
		}
		
		Main.goTo('GamePage')
		Game.setUpGame(game)
	}
*/

}